package com.stm.bi.enums;

/**
 * @author chenyingjun
 * @ClassDesc ES指标类型枚举
 * @date 2023/02/02 9:20
 **/
public enum FieldType {

    KEYWORD("keyword", "关键字"),
    BOOLEAN("boolean", "布朗"),
    DOUBLE("double", "双精度"),
    LONG("long", "长整型"),
    INTEGER("integer", "整型"),
    DATE("date", "时间");
    /**
     * 字段类型值
     */
    private final String value;
    /**
     * 字段类型描述
     */
    private final String desc;

    FieldType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static FieldType getFieldType(String value) {
        for (FieldType ut : FieldType.values()) {
            if (ut.getValue().equals(value)) {
                return ut;
            }
        }
        return null;
    }

    public String getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }
}
